home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 27 / CDROM27.iso / share / progra / mai / Controls, TextBox - Capitalizing the first letter of each word < prev    next >
Encoding:
Text File  |  1997-07-15  |  427 b   |  12 lines

  1. 'Description: Capitalize the first letter of each word in a string
  2.  
  3.   cr$ = Chr$(13) + Chr$(10)
  4.   t$ = Text1.Text  'the string
  5.   If t$ <> "" Then
  6.    Mid$(t$, 1, 1) = UCase$(Mid$(t$, 1, 1))
  7.    For i = 1 To Len(t$) - 1
  8.      If Mid$(t$, i, 2) = cr$ Then Mid$(t$, i + 2, 1) = UCase$(Mid$(t$, i + 2, 1))
  9.      If Mid$(t$, i, 1) = " " Then Mid$(t$, i + 1, 1) = UCase$(Mid$(t$, i + 1, 1))
  10.    Next
  11.    Text1.Text = t$
  12.   End If